﻿Imports BusinessLogicLayer
Imports BE = BusinessEntities


Partial Class Insertarpais
    Inherits System.Web.UI.Page

    Dim errores As String
    Dim mensaje As String
    Public Shared pais As String

    Protected Sub btngrabar_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btngrabar.Click

        'Instanciamos la clase 
        Dim capanegocios As New PaisBL
        'Instancias la entidad 
        Dim objeto As New BE.PaisBE

        'Llenas las propiedades

        objeto.pais = txtnombre.Text

        Try
            If capanegocios.InsertarPais(objeto) = True Then

                mensaje = "Se insertó el pais"
                Dim script As String = "<script language=Javascript>"
                script += "alert('" & mensaje & "');"
                script += "</script>"
                Page.ClientScript.RegisterStartupScript(Me.GetType(), "script", script)


            Else

                mensaje = "No se insertó el pais"
                Dim script As String = "<script language=Javascript>"
                script += "alert('" & mensaje & "');"
                script += "</script>"
                Page.ClientScript.RegisterStartupScript(Me.GetType(), "script", script)

            End If

        Catch ex As Exception
            errores = capanegocios.ChapaError
            Response.Redirect("Errores.aspx?id=" & errores.ToString)
        Finally
            capanegocios = Nothing
            objeto = Nothing
        End Try



    End Sub
End Class
